#!/usr/bin/env bash
dt="`date -d "$d  0 days ago "  "+%Y-%m-%d"`"
mysql -udashuju -pDashuju2017 -h192.168.0.202 -P31006 <<EOF
use wechatmall;
select from_unixtime(A.create_time,'%Y-%m-%d')as day,B.name,sum(A.weight)
from es_order as A
join es_order_items as B
on A.status = 7 and A.order_id = B.order_id
where from_unixtime(A.create_time,'%Y-%m-%d')='$dt'
group by from_unixtime(A.create_time,'%Y-%m-%d'),B.name ;
EOF